<?php
namespace ITSociaal\Themes\HuisVanHerstel;

use TimberMenu;

/**
 * Lazy load menu items
 */
class MenuFacade
{
	use Traits\CreateObject;

	/** @var mixed */
	protected $slug;

	/** @var null|array */
	protected $items;

	/**
	 * @return mixed
	 */
	protected function getSlug()
	{
		return $this->slug;
	}

	/**
	 * Constructor
	 *
	 * @param mixed $slug
	 */
	public function __construct($slug = 0)
	{
		$this->slug = $slug;
	}

	/**
	 * @return array
	 */
	public function get_items()
	{
		$this->items = $this->items ?: $this
			->createObject(TimberMenu::class, $this->getSlug())
			->get_items();

		return $this->items;
	}
}

/* vi:set ts=4 sw=4 noet: */
